#!/bin/bash
function SHCOV(){
    if [ "$COVERAGE" == "true" ]; then
        if [ "$init_coverage" == "false" ]; then
            rm -Rf $COVERAGE_OUTPUT_DIR
            rm -Rf $COVERAGE_HTML_OUTPUT_DIR
            mkdir -p $COVERAGE_OUTPUT_DIR
            mkdir -p $COVERAGE_HTML_OUTPUT_DIR
            init_coverage="true"
        fi
        shcov --output=$COVERAGE_OUTPUT_DIR $*
    else
        ./$*
    fi
}


function SHLCOV(){
    if [ "$COVERAGE" == "true" ]; then
        shlcov $COVERAGE_OUTPUT_DIR/ $COVERAGE_HTML_OUTPUT_DIR
        cp /usr/local/share/shcov/data/*.*  $COVERAGE_HTML_OUTPUT_DIR
    fi
}


function init(){
    MOCK_DATA_DIR=$PROJECT_BASE/src/test/resources/expected
    BUILD_DIRECTORY=$PROJECT_BASE/target
    # Path in ubuntu
    SHUNIT2=". /usr/share/shunit2/shunit2"
    COVERAGE_OUTPUT_DIR="$PROJECT_BASE/target/.coverage"
    COVERAGE_HTML_OUTPUT_DIR="$PROJECT_BASE/target/site/coverage/scripts"
    initialize="true"
    init_coverage="false"
    COVERAGE="false"
}

if [ "$initialize" != "true" ]; then
    init
fi


